// 导入request工具
import request from '@/utils/request';

// 导入token
import { useUserInfoStore } from '@/stores/userInfo';

// 注册接口
export const userRegisterService = (data) => {
    return request.post('/user/register', data, {
        headers: {
            'Content-Type': 'application/json'
        }
    });
}

// 登录接口
export const userLoginService = (data) => {
    return request.post('/user/login', data, {
        headers: {
            'Content-Type': 'application/json'
        }
    });
}

// 获取用户数据接口
export const getUserInfoService = () => {
    return request.get('/user/getUserInfo');
}

// 修改用户密码接口
export const userPasswordUpdateService = (data) => {
    return request.post('/user/updatePassword', data, {
        headers: {
            'Content-Type': 'application/json'
        }
    });
}

// 修改用户昵称接口
export const userNicknameUpdateService = (data) => {
    console.log(data);
    return request.post('/user/updateNikeName', {"nickName": data}, {
        headers: {
            'Content-Type': 'application/json'
        }
    });
}
